var utils = {
  a: 'hello',
  find: function (str, cha, num) {
    var x = str.indexOf(cha)
    for (var i = 0; i < num; i++) {
      x = str.indexOf(cha, x + 1)
    }

    var res = str.substr(x + 1, str.length)
    return res
  },
  switchTimestamp: function (date) {
    return '151051515'
  },
  timestampToDate: function (ts) {
    var date = new Date(ts * 1000)
    var Y = date.getFullYear() + '-'
    var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
    var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + '  '
    var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
    var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':'
    var s = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds())
    return Y + M + D + h + m + s
  },
  dateToTimeStamp: function (dateTmp) {
    var dateS = new Date(dateTmp)
    var date = new Date(dateS.getTime())
    var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
    var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':'
    return h + m
  }
}
export default utils
